
# -------------- Configuration of the Radium Engine targets and definitions -----------------------
# Setup Engine and check for dependencies

# TODO: verify if this is needed
if (Engine_FOUND AND NOT TARGET Engine)
    set(Configure_Engine ON)
    # verify dependencies
    if(NOT Core_FOUND)
        if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../Core/RadiumCoreConfig.cmake")
            set(Core_FOUND TRUE)
            include(${CMAKE_CURRENT_LIST_DIR}/../Core/RadiumCoreConfig.cmake)
        else()
            set(Radium_FOUND False)
            set(Radium_NOT_FOUND_MESSAGE "Radium::Engine: dependency Core not found")
            set(Configure_Engine OFF)
        endif()
    endif()
endif()

# configure Engine component
if(Configure_Engine)
    set(glbinding_DIR "@glbinding_DIR@")
    set(globjects_DIR "@globjects_DIR@")
    set(tinyEXR_DIR "@tinyEXR_DIR@")

    find_dependency(glbinding REQUIRED NO_DEFAULT_PATH)
    find_dependency(globjects REQUIRED NO_DEFAULT_PATH)
    find_dependency(tinyEXR REQUIRED NO_DEFAULT_PATH)
    if(MSVC OR MSVC_IDE OR MINGW)
        add_imported_dir(FROM glbinding::glbinding TO RadiumExternalDlls_location)
        add_imported_dir(FROM globjects::globjects TO RadiumExternalDlls_location)
    endif()
    include("${CMAKE_CURRENT_LIST_DIR}/EngineTargets.cmake")
endif()
